import numpy as np
from scipy.interpolate import interp1d

'''
This file contains FDTD data of different geometries
Structure type a = 
1. height
2. periodicity
3. Varying Radius
.
.
CrossWidth
FinWidth
Length
'''

Data = {1477:('Cylinder-Silicon','a',243,534/2,[695,815,855,975],[0,90,180,270],[0.95,0.9,0.9,0.95]),
        715:('Cylinder-Silicon','a',130,360,[115,120,125,130,135,140,145,150,155],[  0, 23,51,116,238,280,303,327,336],[1,1,1,1,1,1,1,1,1]),
        633:('Cylinder-Silicon','a',280,250,[40,55,60.8,64.5,67.5,70.5,75.3,85.7],[0, 45, 90, 135, 180, 225, 270, 315],[1,1,1,1,1,1,1,1]),
        850:('Cylinder-Silicon','a',475,390,[ 58,67.5,74,77.5,84,87.5,92, 98.5,104.5,112 , 118,126],[0,20,47,73,143,192,235,279,301,322,337,355],[1,1,1,1,1,1,1,1,1,1,1,1]),
        1064:('Cylinder-Silicon','a',170,620,[130, 140,155,165,175,183,195,214,240],[0, 9,29 ,56,112,177,270,324,360],[1,1,1,1,1,1,1,1,1]),
        410000:('Cross-Silicon', 'a',150000,300000,[187000,201000,208000,212000,217000,225000,237000,267000],[0,40,88,133,181,226,269,315],[1,1,1,1,1,1,1,1],70000),
        8800:('Cross-Silicon', 'a',1850,7250,[1000,1523,2045,2568,3091,3614,4136,4659,5182,5705,6227,6750],[0, 3,10,23,53,127,225,277,302, 315,325,337],[1,1,1,1,1,1,1,1],1000),
        532:('Fin-TiO2', 'a', 600, 325,[0,30,60,90,120,150,180],[0,60,120,180,240,300,360],[1,1,1,1,1,1,1],95,250 ),
        405:('Fin-TiO2', 'a', 600, 200,[0,30,60,90,120,150,180],[0,60,120,180,240,300,360],[1,1,1,1,1,1,1],40,150 )
}

def interpolData(dim,P): 
    Ph = np.array(P)
    ##Ph = Ph-np.min(Ph)
    x = np.array(dim)
    f1 = interp1d( Ph,x, kind='cubic')
    P = range(min(Ph),max(Ph),5)
    X = []
    for phi in P:
        try:
            X.append(f1(phi))
        except:
            pass
    return [X,P,f1]

